﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MP/Base.Master" AutoEventWireup="true" CodeBehind="DataProtector.aspx.cs" Inherits="WebsiteAdmin.DataProtec.DataProtector" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head_Title" runat="server">加密解密</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head_Meta" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Head_Css" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Head_Script" runat="server">
    <script type="text/javascript" src="/Script/Mootools.Smoothbox.js"></script>
<script type="text/javascript">

    var MenuViewID = 1;
    window.addEvent('domready', function() {


        $('EncryptBtn').addEvent('click', function() {
            var str = $('txbDecryptString').get('value').trim();
            if (str.length == 0) {
                alert("请输入需要加密的字符串");
                $('txbDecryptString').focus();
            }
            else {
                new Request({
                    url: 'Handler/EncryptDecrypt.ashx',
                    method: "post",
                    noCache: true,
                    data: {
                        reg: 1,
                        str: str
                    },
                    onRequest: function() {
                        LightBox.show();
                    },
                    onSuccess: function(text) {
                        $('txbEncryptString').set('value', text); ;
                        LightBox.remove();
                    },
                    onFailure: function(xhr) {
                        alert(xhr.statusText);
                        LightBox.remove();
                    }
                }).send();
            }
        });


        $('DecryptBtn').addEvent('click', function() {
            var str = $('txbEncrypt').get('value').trim();
            if (str.length == 0) {
                alert("请输入需要解密的字符串");
                $('txbEncrypt').focus();
            }
            else {
                new Request({
                    url: 'Handler/EncryptDecrypt.ashx',
                    method: "post",
                    noCache: true,
                    data: {
                        reg: 2,
                        str: str
                    },
                    onRequest: function() {
                        LightBox.show();
                    },
                    onSuccess: function(text) {
                        $('txbDecrypt').set('value', text); ;
                        LightBox.remove();
                    },
                    onFailure: function(xhr) {
                        alert(xhr.statusText);
                        LightBox.remove();
                    }
                }).send();
            }
        });

    });
    
    </script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Body_Top" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Body_Content" runat="server">
    <div class="infobox">
		<h3>
			<span>加密解密</span>
		</h3>
		  <table border="0" cellpadding="0" cellspacing="0" class="table_form mt10">
            <tr>
                <td align="right" width="100">
                    <b> 数据加密：</b>
                </td>
                <td>
                    <textarea id="txbDecryptString" cols="70" rows="4" style=" border:1px #ccc solid;" ></textarea>
                    <input type="button" id="EncryptBtn" value="加密" class="btn"/>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <b> 加密结果：</b>
                </td>
                <td>
                    <textarea id="txbEncryptString" cols="70" rows="4" style=" background:#f8f8f8; border:1px #ccc solid;" readonly="readonly"></textarea>
                </td>
            </tr>
            <tr style="height:50px"></tr>
            <tr>
                <td align="right">
                   <b> 数据解密：</b>
                </td>
                <td>
                    <textarea id="txbEncrypt" cols="70" rows="4" style="border:1px #ccc solid;" ></textarea>
                    <input type="button" id="DecryptBtn" value="解密" class="btn"/>
            </tr>
            <tr>
                <td align="right">
                   <b>解密结果：</b>
                </td>
                <td>
                    <textarea id="txbDecrypt" cols="70" rows="4" style=" background:#f8f8f8; border:1px #ccc solid;"  readonly="readonly"></textarea>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="Body_Foot" runat="server">
</asp:Content>
